package com.situ.onlinebookstore.back.controller;

import com.situ.onlinebookstore.common.vo.Result;
import com.situ.onlinebookstore.common.util.UploadUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadController {
    @Value("${upload.path}")
    private String path;

    @RequestMapping("/upload")
    public Result upload(MultipartFile file){
        String fileName = UploadUtil.save(file,path);
        return Result.ok(fileName);
    }
}
